package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsGoodsAttributeMapper;
import com.qf.pojo.DtsGoodsAttribute;
import com.qf.service.DtsGoodsAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DtsGoodsAttributeServiceImpl implements DtsGoodsAttributeService {

    @Autowired
    DtsGoodsAttributeMapper attributeMapper;
    @Override
    public void insert(DtsGoodsAttribute attribute) {

        attributeMapper.insert(attribute);
    }

    @Override
    public List<DtsGoodsAttribute> select(Integer goodsId) {

        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("goods_Id",goodsId);
        List<DtsGoodsAttribute> list = attributeMapper.selectList(wrapper);
        return list;
    }

    @Override
    public void update(DtsGoodsAttribute[] attributes) {
        for (DtsGoodsAttribute attribute : attributes) {
            attributeMapper.updateById(attribute);
        }
    }
}
